package com.asset.inventory.network

import com.asset.inventory.model.*
import io.reactivex.Observable
import retrofit2.http.*

/**
 *    @author : sibb
 *    date   : 21-4-7
 *    desc   : Api 接口类
 */
interface Request {

    companion object{
        //todo 替换 格式： http://xxx.xxx.xxx:8080
        val BASE_URL = "http://asset.ahrcu.com:992"
//        val BASE_URL = "http://59.46.220.226:8010"
    }

    /**
     * 登录
     */
    @POST("/login")
    fun login(@Body body: LoginRequest): Observable<Response>


    /**
     * 获取任务列表
     */
    @GET("/dcam/api/w/fixed/inventory/dutys/me")
    fun getTaskList(): Observable<TaskBean>


    /**
     * 获取任务详情
     */
    @GET("/dcam/api/w/fixed/inventory/results")
    fun getTaskDetail(@Query("s_dutyId") dutyId: Long): Observable<TaskDetailBean>

    /**
     * 修改资产属性
     */
    @PUT("/dcam/api/w/fixed/inventory/results/{id}")
    fun putAssetsField(@Path("id") id: Long, @Body body: TaskDetailBean.Detail): Observable<ModifyAssetsModel>

    /*
     * 修改盘点状态
     */
    @PUT("/dcam/api/w/fixed/inventory/results/{id}/{status}")
    fun putState(@Path("id") id: Long, @Path("status") status: String): Observable<Response>

    /**
     * 获取部门人员数据
     */
    @GET("/dcam/api/w/auth/organizations/ex")
    fun getOrgList(): Observable<OrgModel>

    /**
     * 获取可用位置列表
     */
    @GET("/dcam/api/w/locations/flat/tree")
    fun getEnableLoctionList(): Observable<LocationModel>

    /**
     * 提交任务
     */
    @PUT("/dcam/api/w/fixed/inventory/dutys/enable/{id}/status/finish")
    fun commit(@Path("id") id: Long): Observable<ModifyAssetsModel>

    /**
     * 批量盘平
     */
    @PUT("/dcam/api/w/fixed/inventory/results/batch")
    fun commitList(@Body ids: List<Long>): Observable<ModifyAssetsModel>


}